-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow non-strings to be used to set ttl
field in generic.
#2699
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
b = testPassthroughBackend() | ||
test(b, "lease", false) | ||
test(b, "ttl", false) | ||
test(b, "lease", int64(10), false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we test for passing 10
directly, as opposed to int64(10)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this ensures that the interface value is the right type. Otherwise this defaults to an int.
vault/logical_passthrough.go
Outdated
if !ok { | ||
ttlInt, ok = rawData["lease"] | ||
} | ||
if ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jefferai Do we not want to do this regardless of ok
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if ok
isn't true then neither of those fields exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see now.
vault/logical_passthrough.go
Outdated
ttlDuration := b.System().DefaultLeaseTTL() | ||
if len(ttl) != 0 { | ||
dur, err := parseutil.ParseDurationSecond(ttl) | ||
ttlInt, ok := rawData["ttl"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small nit, but I interpreted this variable as "TTL integer" when i think it's supposed to be "TTL interface", could you rename it to ttlRaw
or something similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than that one comment LGTM!
Fixes #2697